﻿// Copyright (c) Inossem. All rights reserved.
// Licensed under the LGPL-3.0 license. See LICENSE file in the project root for full license information.
using DWF.Studio.V8Communicator.Messages;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace DWF.Studio.V8Communicator
{
    public interface ICommunicator : IDisposable
    {
        Task ConnectAsync(CancellationToken cancellationToken);
        Task<string> SendCommandAsync(string method, object parameters = null);
        Task<TEvent> WaitForEventAsync<TEvent>(CancellationToken token) where TEvent : IV8ResponeseParams;
        Task<TEvent> WaitForEventAsync<TEvent>() where TEvent : IV8ResponeseParams;
        Task DisconnectAsync(CancellationToken cancellationToken);
    }
}